package com.cnap.multiclouldmgmt.model.k8sModels;

import com.cnap.multiclouldmgmt.model.K8sClusterInfoModel;
import com.cnap.multiclouldmgmt.util.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 集群组件基础信息
 * @author dyq
 */
@ApiModel(value = "com.cnap.multiclouldmgmt.model.k8sModel.NodeModel",description = "节点信息")
public class NodeModel extends K8sClusterInfoModel {

    //节点名称
    @ApiModelProperty(value = "node名称")
    private String nodeName;

    //节点类型
    @ApiModelProperty(value = "节点类型")
    private String nodeType;

    //节点硬件类型
    @ApiModelProperty(value = "节点硬件类型类型")
    private String nodeHardware;


    //部署位置
    @ApiModelProperty(value = "部署位置")
    private String location;

    //node角色
    @ApiModelProperty(value = "node角色")
    private String nodeRole;

    //状态
    @ApiModelProperty(value = "状态")
    private String status;

    //架构
    @ApiModelProperty(value = "架构")
    private String framework;

    //ip
    @ApiModelProperty(value = "ip")
    private String nodeIp;

    //节点容器组总额度
    @ApiModelProperty(value = "节点容器组总额度")
    private int nodeContainerQuota;

    //节点容器组已分配数量
    @ApiModelProperty(value = "节点容器组已分配数量")
    private int nodeContainerUseNum;

    //节点容器组正常的数量
    @ApiModelProperty(value = "节点容器组正常的数量")
    private int nodeContainerNormalNum;

    //节点Cpu总额度，为个数
    @ApiModelProperty(value = "节点Cpu总额度，单位m等于核心数*1000")
    private int nodeCpuQuota;

    //节点Cpu总额度，单位为n
    @ApiModelProperty(value = "节点Cpu总额度，单位为n")
    private long nodeCpuQuotaByN;

    //节点Cpu已分配数量，为个数，带小数
    @ApiModelProperty(value = "节点Cpu已分配数量，单位m等于核心数*1000")
    private String nodeCpuUseNum;

    //节点cpu使用量，单位为n
    @ApiModelProperty(value = "节点Cpu已分配数量，单位为n")
    private long nodeCpuUseByN;

    //节点内存总额度，单位G
    @ApiModelProperty(value = "节点内存总额度")
    private int nodeMemQuota;

    //节点内存总额度，单位ki
    @ApiModelProperty(value = "节点内存总额度单位ki")
    private long nodeMemQuotaByKi;

    //节点内存已分配数量，单位G
    @ApiModelProperty(value = "节点内存已分配数量")
    private String nodeMemUseNum;

    //节点内存已分配数量，单位ki
    @ApiModelProperty(value = "节点内存已分配数量，单位ki")
    private long nodeMemUseNumByKi;

    //节点硬盘总额度，单位G
    @ApiModelProperty(value = "节点硬盘总额度，单位G")
    private int nodeDiskQuota;

    //节点硬盘已分配数量，单位G
    @ApiModelProperty(value = "节点硬盘已分配数量，单位G")
    private int nodeDiskUseNum;

    //系统硬盘总额度
    @ApiModelProperty(value = "系统节点硬盘总额度，单位G")
    private int nodeSysDiskQuota;

    //系统硬盘使用额度，单位G
    @ApiModelProperty(value = "系统节点硬盘已分配数量，单位G")
    private int nodeSysDiskUseNum;

    //创建时间
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    //创建时间格式化
    @ApiModelProperty(value = "创建时间格式化")
    private String createTimeStr;

    //node中网络iops
    @ApiModelProperty(value = "node中网络iops")
    private long nodeNetIops;

    //node中的pod
    @ApiModelProperty(value = "node中的pod")
    private List<PodModel> podModels;

    //node的label集合
    @ApiModelProperty(value = "node的label集合")
    private Map<String,String> nodeLabelMap;

    //node的对应的vm的标识
    @ApiModelProperty(value = "node的对应的vm的标识")
    private String vmName;

    //node app Type
    @ApiModelProperty(value = "node对应的app type")
    private String nodeAppType;

    @ApiModelProperty(value = "硬盘的iops")
    private int diskIops;

    @ApiModelProperty(value = "硬盘读写速率，mb/s")
    private int diskThroughput;

    @ApiModelProperty(value = "网络带宽，mbps")
    private int netBandwidth;

    //gpu使用率
    @ApiModelProperty(value = "gpu使用率")
    private double nodeGpuUsage;

    //gpu显存使用率
    @ApiModelProperty(value = "gpu显存使用率")
    private double nodeGpuMemUsage;

    //gpu显卡温度
    @ApiModelProperty(value = "gpu显卡温度")
    private double nodeGpuTemp;

    //gpu功率
    @ApiModelProperty(value = "gpu功率")
    private double nodeGpuPower;

    //gpu显存使用率
    @ApiModelProperty(value = "gpu显卡型号和个数NVIDIA A10*1")
    private String nodeGpuSpec;

    //gpu显存使用率
    @ApiModelProperty(value = "gpu显存字段24GB*1")
    private String nodeGpuMemStr;

    //gpu显存使用量
    @ApiModelProperty(value = "gpu显存使用量，单位g")
    private double nodeGpuMemUse;

    //gpu显存使用率
    @ApiModelProperty(value = "gpu显存容量")
    private double nodeGpuMemTotal;

    //ip
    @ApiModelProperty(value = "内网ip")
    private String nodeInnerIp;

    //ip
    @ApiModelProperty(value = "外网ip")
    private String nodeExtranlIp;

    /**
     * get
     *
     * @return NodeInnerIp
     */
    public String getNodeInnerIp() {
        return nodeInnerIp;
    }

    /**
     * set
     *
     * @param nodeInnerIp nodeInnerIp
     */
    public void setNodeInnerIp(String nodeInnerIp) {
        this.nodeInnerIp = nodeInnerIp;
    }

    /**
     * get
     *
     * @return NodeExtranlIp
     */
    public String getNodeExtranlIp() {
        return nodeExtranlIp;
    }

    /**
     * set
     *
     * @param nodeExtranlIp nodeExtranlIp
     */
    public void setNodeExtranlIp(String nodeExtranlIp) {
        this.nodeExtranlIp = nodeExtranlIp;
    }

    /**
     * get
     *
     * @return NodeGpuMemTotal
     */
    public double getNodeGpuMemTotal() {
        return nodeGpuMemTotal;
    }

    /**
     * set
     *
     * @param nodeGpuMemTotal nodeGpuMemTotal
     */
    public void setNodeGpuMemTotal(double nodeGpuMemTotal) {
        this.nodeGpuMemTotal = nodeGpuMemTotal;
    }

    /**
     * get
     *
     * @return NodeGpuMemUse
     */
    public double getNodeGpuMemUse() {
        return nodeGpuMemUse;
    }

    /**
     * set
     *
     * @param nodeGpuMemUse nodeGpuMemUse
     */
    public void setNodeGpuMemUse(double nodeGpuMemUse) {
        this.nodeGpuMemUse = nodeGpuMemUse;
    }

    /**
     * get
     *
     * @return NodeGpuSpec
     */
    public String getNodeGpuSpec() {
        return nodeGpuSpec;
    }

    /**
     * set
     *
     * @param nodeGpuSpec nodeGpuSpec
     */
    public void setNodeGpuSpec(String nodeGpuSpec) {
        this.nodeGpuSpec = nodeGpuSpec;
    }

    /**
     * get
     *
     * @return NodeGpuMemStr
     */
    public String getNodeGpuMemStr() {
        return nodeGpuMemStr;
    }

    /**
     * set
     *
     * @param nodeGpuMemStr nodeGpuMemStr
     */
    public void setNodeGpuMemStr(String nodeGpuMemStr) {
        this.nodeGpuMemStr = nodeGpuMemStr;
    }

    /**
     * get
     *
     * @return NodeGpuUsage
     */
    public double getNodeGpuUsage() {
        return nodeGpuUsage;
    }

    /**
     * set
     *
     * @param nodeGpuUsage nodeGpuUsage
     */
    public void setNodeGpuUsage(double nodeGpuUsage) {
        this.nodeGpuUsage = nodeGpuUsage;
    }

    /**
     * get
     *
     * @return NodeGpuMemUsage
     */
    public double getNodeGpuMemUsage() {
        return nodeGpuMemUsage;
    }

    /**
     * set
     *
     * @param nodeGpuMemUsage nodeGpuMemUsage
     */
    public void setNodeGpuMemUsage(double nodeGpuMemUsage) {
        this.nodeGpuMemUsage = nodeGpuMemUsage;
    }

    /**
     * get
     *
     * @return NodeGpuTemp
     */
    public double getNodeGpuTemp() {
        return nodeGpuTemp;
    }

    /**
     * set
     *
     * @param nodeGpuTemp nodeGpuTemp
     */
    public void setNodeGpuTemp(double nodeGpuTemp) {
        this.nodeGpuTemp = nodeGpuTemp;
    }

    /**
     * get
     *
     * @return NodeGpuPower
     */
    public double getNodeGpuPower() {
        return nodeGpuPower;
    }

    /**
     * set
     *
     * @param nodeGpuPower nodeGpuPower
     */
    public void setNodeGpuPower(double nodeGpuPower) {
        this.nodeGpuPower = nodeGpuPower;
    }

    /**
     * get
     *
     * @return DiskIops
     */
    public int getDiskIops() {
        return diskIops;
    }

    /**
     * set
     *
     * @param diskIops diskIops
     */
    public void setDiskIops(int diskIops) {
        this.diskIops = diskIops;
    }

    /**
     * get
     *
     * @return DiskThroughput
     */
    public int getDiskThroughput() {
        return diskThroughput;
    }

    /**
     * set
     *
     * @param diskThroughput diskThroughput
     */
    public void setDiskThroughput(int diskThroughput) {
        this.diskThroughput = diskThroughput;
    }

    /**
     * get
     *
     * @return NetBandwidth
     */
    public int getNetBandwidth() {
        return netBandwidth;
    }

    /**
     * set
     *
     * @param netBandwidth netBandwidth
     */
    public void setNetBandwidth(int netBandwidth) {
        this.netBandwidth = netBandwidth;
    }

    /**
     * get
     *
     * @return NodeHardware
     */
    public String getNodeHardware() {

        if (StringUtils.isEmpty(nodeHardware)){
            nodeHardware = getArch();
        }

        return nodeHardware;
    }

    /**
     * set
     *
     * @param nodeHardware nodeHardware
     */
    public void setNodeHardware(String nodeHardware) {
        this.nodeHardware = nodeHardware;
    }

    /**
     * get
     *
     * @return NodeAppType
     */
    public String getNodeAppType() {
        return nodeAppType;
    }

    /**
     * set
     *
     * @param nodeAppType nodeAppType
     */
    public void setNodeAppType(String nodeAppType) {
        this.nodeAppType = nodeAppType;
    }

    public String getCreateTimeStr() {

        if ((StringUtils.isEmpty(createTimeStr))
                &&(createTime != null)){
            createTimeStr = DateUtils.changeDateFormatYYYYMMDDHHMMSS(createTime);
        }

        return createTimeStr;
    }

    /**
     * get
     *
     * @return NodeName
     */
    public String getNodeName() {
        return nodeName;
    }

    /**
     * set
     *
     * @param nodeName nodeName
     */
    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    /**
     * get
     *
     * @return NodeType
     */
    public String getNodeType() {
        return nodeType;
    }

    /**
     * set
     *
     * @param nodeType nodeType
     */
    public void setNodeType(String nodeType) {
        this.nodeType = nodeType;
    }

    /**
     * get
     *
     * @return Location
     */
    public String getLocation() {
        return location;
    }

    /**
     * set
     *
     * @param location location
     */
    public void setLocation(String location) {
        this.location = location;
    }

    /**
     * get
     *
     * @return NodeRole
     */
    public String getNodeRole() {
        return nodeRole;
    }

    /**
     * set
     *
     * @param nodeRole nodeRole
     */
    public void setNodeRole(String nodeRole) {
        this.nodeRole = nodeRole;
    }

    /**
     * get
     *
     * @return Status
     */
    public String getStatus() {
        return status;
    }

    /**
     * set
     *
     * @param status status
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * get
     *
     * @return Framework
     */
    public String getFramework() {
        return framework;
    }

    /**
     * set
     *
     * @param framework framework
     */
    public void setFramework(String framework) {
        this.framework = framework;
    }

    /**
     * get
     *
     * @return NodeIp
     */
    public String getNodeIp() {
        return nodeIp;
    }

    /**
     * set
     *
     * @param nodeIp nodeIp
     */
    public void setNodeIp(String nodeIp) {
        this.nodeIp = nodeIp;
    }

    /**
     * get
     *
     * @return NodeContainerQuota
     */
    public int getNodeContainerQuota() {
        return nodeContainerQuota;
    }

    /**
     * set
     *
     * @param nodeContainerQuota nodeContainerQuota
     */
    public void setNodeContainerQuota(int nodeContainerQuota) {
        this.nodeContainerQuota = nodeContainerQuota;
    }

    /**
     * get
     *
     * @return NodeContainerUseNum
     */
    public int getNodeContainerUseNum() {
        return nodeContainerUseNum;
    }

    /**
     * set
     *
     * @param nodeContainerUseNum nodeContainerUseNum
     */
    public void setNodeContainerUseNum(int nodeContainerUseNum) {
        this.nodeContainerUseNum = nodeContainerUseNum;
    }

    /**
     * get
     *
     * @return NodeContainerNormalNum
     */
    public int getNodeContainerNormalNum() {
        return nodeContainerNormalNum;
    }

    /**
     * set
     *
     * @param nodeContainerNormalNum nodeContainerNormalNum
     */
    public void setNodeContainerNormalNum(int nodeContainerNormalNum) {
        this.nodeContainerNormalNum = nodeContainerNormalNum;
    }

    /**
     * get
     *
     * @return NodeCpuQuota
     */
    public int getNodeCpuQuota() {
        return nodeCpuQuota;
    }

    /**
     * set
     *
     * @param nodeCpuQuota nodeCpuQuota
     */
    public void setNodeCpuQuota(int nodeCpuQuota) {
        this.nodeCpuQuota = nodeCpuQuota;
    }

    /**
     * get
     *
     * @return NodeCpuQuotaByN
     */
    public long getNodeCpuQuotaByN() {
        return nodeCpuQuotaByN;
    }

    /**
     * set
     *
     * @param nodeCpuQuotaByN nodeCpuQuotaByN
     */
    public void setNodeCpuQuotaByN(long nodeCpuQuotaByN) {
        this.nodeCpuQuotaByN = nodeCpuQuotaByN;
    }

    /**
     * get
     *
     * @return NodeCpuUseNum
     */
    public String getNodeCpuUseNum() {
        return nodeCpuUseNum;
    }

    /**
     * set
     *
     * @param nodeCpuUseNum nodeCpuUseNum
     */
    public void setNodeCpuUseNum(String nodeCpuUseNum) {
        this.nodeCpuUseNum = nodeCpuUseNum;
    }

    /**
     * get
     *
     * @return NodeCpuUseByN
     */
    public long getNodeCpuUseByN() {
        return nodeCpuUseByN;
    }

    /**
     * set
     *
     * @param nodeCpuUseByN nodeCpuUseByN
     */
    public void setNodeCpuUseByN(long nodeCpuUseByN) {
        this.nodeCpuUseByN = nodeCpuUseByN;
    }

    /**
     * get
     *
     * @return NodeMemQuota
     */
    public int getNodeMemQuota() {
        return nodeMemQuota;
    }

    /**
     * set
     *
     * @param nodeMemQuota nodeMemQuota
     */
    public void setNodeMemQuota(int nodeMemQuota) {
        this.nodeMemQuota = nodeMemQuota;
    }

    /**
     * get
     *
     * @return NodeMemQuotaByKi
     */
    public long getNodeMemQuotaByKi() {
        return nodeMemQuotaByKi;
    }

    /**
     * set
     *
     * @param nodeMemQuotaByKi nodeMemQuotaByKi
     */
    public void setNodeMemQuotaByKi(long nodeMemQuotaByKi) {
        this.nodeMemQuotaByKi = nodeMemQuotaByKi;
    }

    /**
     * get
     *
     * @return NodeMemUseNum
     */
    public String getNodeMemUseNum() {
        return nodeMemUseNum;
    }

    /**
     * set
     *
     * @param nodeMemUseNum nodeMemUseNum
     */
    public void setNodeMemUseNum(String nodeMemUseNum) {
        this.nodeMemUseNum = nodeMemUseNum;
    }

    /**
     * get
     *
     * @return NodeMemUseNumByKi
     */
    public long getNodeMemUseNumByKi() {
        return nodeMemUseNumByKi;
    }

    /**
     * set
     *
     * @param nodeMemUseNumByKi nodeMemUseNumByKi
     */
    public void setNodeMemUseNumByKi(long nodeMemUseNumByKi) {
        this.nodeMemUseNumByKi = nodeMemUseNumByKi;
    }

    /**
     * get
     *
     * @return NodeDiskQuota
     */
    public int getNodeDiskQuota() {
        return nodeDiskQuota;
    }

    /**
     * set
     *
     * @param nodeDiskQuota nodeDiskQuota
     */
    public void setNodeDiskQuota(int nodeDiskQuota) {
        this.nodeDiskQuota = nodeDiskQuota;
    }

    /**
     * get
     *
     * @return NodeDiskUseNum
     */
    public int getNodeDiskUseNum() {
        return nodeDiskUseNum;
    }

    /**
     * set
     *
     * @param nodeDiskUseNum nodeDiskUseNum
     */
    public void setNodeDiskUseNum(int nodeDiskUseNum) {
        this.nodeDiskUseNum = nodeDiskUseNum;
    }

    /**
     * get
     *
     * @return CreateTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * set
     *
     * @param createTime createTime
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * set
     *
     * @param createTimeStr createTimeStr
     */
    public void setCreateTimeStr(String createTimeStr) {
        this.createTimeStr = createTimeStr;
    }

    /**
     * get
     *
     * @return NodeNetIops
     */
    public long getNodeNetIops() {
        return nodeNetIops;
    }

    /**
     * set
     *
     * @param nodeNetIops nodeNetIops
     */
    public void setNodeNetIops(long nodeNetIops) {
        this.nodeNetIops = nodeNetIops;
    }

    /**
     * get
     *
     * @return PodModels
     */
    public List<PodModel> getPodModels() {
        return podModels;
    }

    /**
     * set
     *
     * @param podModels podModels
     */
    public void setPodModels(List<PodModel> podModels) {
        this.podModels = podModels;
    }

    /**
     * get
     *
     * @return NodeLabelMap
     */
    public Map<String, String> getNodeLabelMap() {
        return nodeLabelMap;
    }

    /**
     * set
     *
     * @param nodeLabelMap nodeLabelMap
     */
    public void setNodeLabelMap(Map<String, String> nodeLabelMap) {
        this.nodeLabelMap = nodeLabelMap;
    }

    /**
     * get
     *
     * @return VmName
     */
    public String getVmName() {
        return vmName;
    }

    /**
     * set
     *
     * @param vmName vmName
     */
    public void setVmName(String vmName) {
        this.vmName = vmName;
    }

    public int getNodeSysDiskQuota() {
        return nodeSysDiskQuota;
    }

    public void setNodeSysDiskQuota(int nodeSysDiskQuota) {
        this.nodeSysDiskQuota = nodeSysDiskQuota;
    }

    public int getNodeSysDiskUseNum() {
        return nodeSysDiskUseNum;
    }

    public void setNodeSysDiskUseNum(int nodeSysDiskUseNum) {
        this.nodeSysDiskUseNum = nodeSysDiskUseNum;
    }
}
